export function login(data) {
    return new Promise((resolve, reject) => {
        request({
                url: "http://127.0.0.1/list/all",
                method: "get",
                data,
            })
            .then((res) => {
                let {
                    data
                } = res.data;
                let {
                    token
                } = data;
                delete data.token;
                localStorage.setItem("token", token);
                sessionStorage.setItem("token", token);
                sessionStorage.setItem("loginType", loginType);
                sessionStorage.setItem("userInfo", JSON.stringify(data));
                localStorage.setItem("userInfo", JSON.stringify(data));
                resolve(res.data);
            })
            .catch((e) => {
                reject(e);
            });
    });
}

// export function logout() {
//     return request({
//         url: "/sys/logout",
//         method: "post",
//     }).then((res) => {
//         if (res.data.code == 0) {
//             sessionStorage.clear();
//             localStorage.clear();
//         }
//     });
// }